package com.lmh.graphdisease.repository;

import com.lmh.graphdisease.entity.CheckEntity;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author lmh
 * @desc
 * @date 2023/4/13
 */
@Repository
public interface CheckRepository extends Neo4jRepository<CheckEntity,Long> {

    @Query("MATCH (n:Check) RETURN n SKIP $0 LIMIT $1")
    List<CheckEntity> getNumCheck(int page, int size);

    @Query("MATCH (n:Check) RETURN count(*)")
    Integer getCheckNum();

    @Query("CREATE(f:Check {name:$0})")
    void addCheck(String name);

    @Query("MATCH (f:Check) WHERE f.name = $0 RETURN f")
    CheckEntity getCheckByName(String name);

    @Query("MATCH(f:Check{name:$0}) DELETE f")
    void deleteByName(String name);
}
